package req;

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;
/*
*   request对象
    *   处理请求行
    *       1.获取请求方式    getMethod()
    *       2.获取应用上下文   getContextPath()
    *       3.获取servlet路径  getServletPath()
    *       4.获取请求的参数字符串    getQueryString()
    *       4.获取请求路径    getRequestURI(),相当于getContextPath() + getServletPath()
    *       5.获取请求连接    getRequestURL(),相当于 端口号 + getContextPath() + getServletPath()
    *   处理请求头
    *       1.获取请求头的名字    getHeaderNames()
    *       2.获取请求头的值      getHeader(String name)
    *   处理请求体
    *       1.获取请求体的参数
    *         getParameter(String name)
    *         getParameterValues(String name)
    *               遍历 Stream.of(getParameterValues(name).forEach(System.out::println))
    *         getParameterMap()  Map< String , String[] >
                    遍历 getParameterMap().forEach((key, value) -> {
                            System.out.println(key + "=" + value);
                        })

* */
@WebServlet(value = "/req/demo01")
public class requestDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
